import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../websocket_controller.dart';

class Breathe extends StatelessWidget {
  const Breathe({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetBuilder<WebsocketController>(
      init: WebsocketController(),
      builder: (controller) {
        return AnimatedContainer(
          height: 14,
          width: controller.breathe ? 4 : 4,
          decoration: BoxDecoration(
            borderRadius: const BorderRadius.only(
              topLeft: Radius.circular(10),
              bottomLeft: Radius.circular(10),
            ),
            color: controller.isConnect
                ? (controller.breathe ? Colors.green : Colors.white)
                : (controller.breathe ? Colors.red : Colors.white),
          ),
          duration: const Duration(
            seconds: 1,
          ),
        );
      },
    );
  }
}
